/*******************************************************************************
Replication Materials for Blau, Kahn, Brummund, Cook, and Larson-Koester "Is 
There Still Son Preference in the United States?"

Table AT3

Date Modified: 10/21/2019

*******************************************************************************/




*-------------------------------------------------------------------------------
                                   *LOAD DATA
*-------------------------------------------------------------------------------
use "$acs\acs_data", clear

*-------------------------------------------------------------------------------
                                 *RESTRICT SAMPLE
*-------------------------------------------------------------------------------
keep if nonrkids == 0 & nonusbirth == 0 & sfrelate == 0 & father_sample != 1 ///
	& multi_sample != 1 & mult == 0 & female == 1 & oldc <=12 & ///
	inrange(age,18,40)==1 & foster_hh == 0 & nchild18>=1
drop if marst == 5
drop if citizen == 1

*-------------------------------------------------------------------------------
                                 *GENERATE VARS
*-------------------------------------------------------------------------------

// for F-test, can't use i.operator
tabulate year, gen(year_)
tabulate region, gen(region_)
tabulate genrace, gen(race_)
drop year_1 region_1 race_1


*-------------------------------------------------------------------------------
                                  *REGRESSIONS
*-------------------------------------------------------------------------------
local controls2 "lths scol cold" //leave out: hsdi
local controls2 "`controls2' race_2 race_3 race_4 race_5 region_2 region_3 region_4 region_5 region_6 region_7 region_8 region_9 year_2 year_3 year_4 year_5 year_6 age age2 age3"
local wgt "hhwtnorm"


// IMMIGRANTS:
reg chld1 `controls2' if native == 0 [aw=`wgt'],  robust
test `controls2'
local f: display %5.4f  r(F)
local p: display %5.4f  r(p)
outreg2 using "$toutput\TA_3", replace excel dec(4) addtext(F-stat, `f', Prob > F, `p') label nocons nor2 ///
	title("Table A3 : Probability that First Child is a Girl (Linear Prob Models)")

// IMMIGRANTS, COUNTRY CONTROLS:
reg chld1 `controls2' yrsusa1 yrsusa2 igenfert igenscore ligengdp ///
	if native==0 [aw=`wgt'], cluster(bpldc)	
test `controls2' yrsusa1 yrsusa2 igenfert igenscore ligengdp
local f: display %5.4f  r(F)
local p: display %5.4f  r(p)
outreg2 using "$toutput\TA_3", append excel dec(4) addtext(F-stat, `f', Prob > F, `p') label nocons nor2

// NATIVES:		
reg chld1 `controls2' if native == 1 [aw=`wgt'],  robust
test `controls2'
local f: display %5.4f  r(F)
local p: display %5.4f  r(p)
outreg2 using "$toutput\TA_3", append excel dec(4) addtext(F-stat, `f', Prob > F, `p')	label nocons nor2
		
